package com.xlh.enums.course;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 课程导航类型
 * <p>
 * Created by lx on 2019/1/28.
 */
@Getter
@AllArgsConstructor
public enum CourseNavigationTypeEnum {

    PRODUCTION(1, "制作"),
    NOT_PRODUCTION(2, "非制作");

    private int code;

    private String message;

    public static CourseNavigationTypeEnum getByCode(int code) {
        for (CourseNavigationTypeEnum courseNavigationTypeEnum : CourseNavigationTypeEnum.values()) {
            if (Objects.equals(courseNavigationTypeEnum.getCode(), code)) {
                return courseNavigationTypeEnum;
            }
        }
        return null;
    }

    public static String getMessageByCode(int code) {
        CourseNavigationTypeEnum courseNavigationTypeEnum = getByCode(code);
        return courseNavigationTypeEnum == null ? null : courseNavigationTypeEnum.getMessage();
    }

}
